package(default_visibility = ["//:__subpackages__"])

licenses(["notice"])

cc_library(
    name = "prf_based_deriver",
    srcs = ["prf_based_deriver.cc"],
    hdrs = ["prf_based_deriver.h"],
    include_prefix = "tink/keyderivation/internal",
    deps = [
        ":config_prf_for_deriver",
        ":key_derivers",
        "//:cleartext_keyset_handle",
        "//:input_stream",
        "//:key",
        "//:key_status",
        "//:keyset_handle",
        "//:keyset_handle_builder",
        "//:parameters",
        "//aead:aes_gcm_proto_serialization",
        "//internal:configuration_impl",
        "//internal:key_type_info_store",
        "//internal:mutable_serialization_registry",
        "//internal:proto_parameters_serialization",
        "//internal:registry_impl",
        "//keyderivation:keyset_deriver",
        "//proto:tink_cc_proto",
        "//subtle/prf:streaming_prf",
        "//util:status",
        "//util:statusor",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/strings:string_view",
    ],
)

cc_test(
    name = "prf_based_deriver_test",
    srcs = ["prf_based_deriver_test.cc"],
    deps = [
        ":prf_based_deriver",
        "//:cleartext_keyset_handle",
        "//:insecure_secret_key_access",
        "//:key_status",
        "//:keyset_handle",
        "//:partial_key_access",
        "//:registry",
        "//aead:aead_key_templates",
        "//aead:aes_ctr_hmac_aead_key_manager",
        "//aead:aes_gcm_key",
        "//aead:aes_gcm_key_manager",
        "//aead:aes_gcm_parameters",
        "//internal:registry_impl",
        "//keyderivation:keyset_deriver",
        "//prf:hkdf_prf_key_manager",
        "//proto:aes_gcm_cc_proto",
        "//proto:common_cc_proto",
        "//proto:hkdf_prf_cc_proto",
        "//proto:tink_cc_proto",
        "//subtle:random",
        "//subtle/prf:streaming_prf",
        "//util:statusor",
        "//util:test_matchers",
        "//util:test_util",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings:string_view",
        "@com_google_absl//absl/types:optional",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_library(
    name = "prf_based_deriver_key_manager",
    hdrs = ["prf_based_deriver_key_manager.h"],
    include_prefix = "tink/keyderivation/internal",
    deps = [
        ":prf_based_deriver",
        "//:core/key_type_manager",
        "//:core/template_util",
        "//:registry",
        "//keyderivation:keyset_deriver",
        "//proto:prf_based_deriver_cc_proto",
        "//proto:tink_cc_proto",
        "//util:constants",
        "//util:status",
        "//util:statusor",
        "//util:validation",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
    ],
)

cc_test(
    name = "prf_based_deriver_key_manager_test",
    srcs = ["prf_based_deriver_key_manager_test.cc"],
    deps = [
        ":prf_based_deriver",
        ":prf_based_deriver_key_manager",
        "//:cleartext_keyset_handle",
        "//:keyset_handle",
        "//:registry",
        "//aead:aead_key_templates",
        "//aead:aes_gcm_key_manager",
        "//keyderivation:keyset_deriver",
        "//prf:hkdf_prf_key_manager",
        "//proto:aes_gcm_cc_proto",
        "//proto:hkdf_prf_cc_proto",
        "//proto:prf_based_deriver_cc_proto",
        "//proto:tink_cc_proto",
        "//subtle",
        "//util:statusor",
        "//util:test_matchers",
        "//util:test_util",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/status",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_library(
    name = "key_derivers",
    srcs = ["key_derivers.cc"],
    hdrs = ["key_derivers.h"],
    include_prefix = "tink/keyderivation/internal",
    deps = [
        "//:input_stream",
        "//:insecure_secret_key_access",
        "//:key",
        "//:parameters",
        "//:partial_key_access",
        "//:restricted_data",
        "//aead:aes_gcm_key",
        "//aead:aes_gcm_parameters",
        "//aead:aes_gcm_proto_serialization",
        "//proto:aes_gcm_cc_proto",
        "//proto:tink_cc_proto",
        "//util:input_stream_util",
        "//util:status",
        "//util:statusor",
        "@com_google_absl//absl/container:flat_hash_map",
        "@com_google_absl//absl/functional:any_invocable",
        "@com_google_absl//absl/log:check",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
        "@com_google_absl//absl/strings:string_view",
        "@com_google_absl//absl/types:optional",
    ],
)

cc_test(
    name = "key_derivers_test",
    srcs = ["key_derivers_test.cc"],
    deps = [
        ":key_derivers",
        "//:input_stream",
        "//:insecure_secret_key_access",
        "//:key",
        "//:key_status",
        "//:keyset_handle",
        "//:keyset_handle_builder",
        "//:partial_key_access",
        "//:registry",
        "//:restricted_data",
        "//:secret_key_access_token",
        "//aead:aes_eax_parameters",
        "//aead:aes_eax_proto_serialization",
        "//aead:aes_gcm_key",
        "//aead:aes_gcm_key_manager",
        "//aead:aes_gcm_parameters",
        "//aead:aes_gcm_proto_serialization",
        "//internal:mutable_serialization_registry",
        "//internal:proto_parameters_serialization",
        "//internal:serialization",
        "//prf:hkdf_prf_key_manager",
        "//proto:aes_gcm_cc_proto",
        "//proto:common_cc_proto",
        "//proto:hkdf_prf_cc_proto",
        "//proto:tink_cc_proto",
        "//subtle:common_enums",
        "//subtle:random",
        "//subtle/prf:hkdf_streaming_prf",
        "//subtle/prf:streaming_prf",
        "//util:istream_input_stream",
        "//util:secret_data",
        "//util:statusor",
        "//util:test_matchers",
        "//util:test_util",
        "@com_google_absl//absl/memory",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/types:optional",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_library(
    name = "config_prf_for_deriver",
    hdrs = ["config_prf_for_deriver.h"],
    include_prefix = "tink/keyderivation/internal",
    deps = [
        "//:configuration",
        "//internal:configuration_impl",
        "//prf:hkdf_prf_key_manager",
        "@com_google_absl//absl/log:check",
        "@com_google_absl//absl/memory",
    ],
)

cc_test(
    name = "config_prf_for_deriver_test",
    srcs = ["config_prf_for_deriver_test.cc"],
    deps = [
        ":config_prf_for_deriver",
        "//internal:configuration_impl",
        "//internal:key_type_info_store",
        "//prf:hkdf_prf_key_manager",
        "//proto:tink_cc_proto",
        "//subtle/prf:streaming_prf",
        "//util:input_stream_util",
        "//util:statusor",
        "//util:test_matchers",
        "//util:test_util",
        "@com_google_googletest//:gtest_main",
    ],
)
